package com.wh.custom.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wh.custom.dao.CustomSalesmanMapper;
import com.wh.custom.dto.CustomSalesmanQueryDto;
import com.wh.custom.pojo.CustomSalesman;
import com.wh.custom.service.ICustomSalesmanService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class CustomSalesmanServiceImpl extends ServiceImpl<CustomSalesmanMapper, CustomSalesman> implements ICustomSalesmanService  {
    @Autowired
    private CustomSalesmanMapper customSalesmanMapper;
    @Transactional


    @Override
    public IPage<CustomSalesman> findByPage(CustomSalesmanQueryDto customSalesmanQueryDto) {
        //1.创建查询条件
        QueryWrapper<CustomSalesman> qw = new QueryWrapper<>();
        //qw.like("xxx",customMycustomQueryDto.getXxx());
        //qw.or();
        //qw.like("xxx",customMycustomQueryDto.getXxx());
        //2.组件分页数据
        IPage<CustomSalesman> page = new Page<>(customSalesmanQueryDto.getCurrentPage(), customSalesmanQueryDto.getPageSize());
        page.setRecords(customSalesmanMapper.findByPage(page,qw));
        page.setTotal(customSalesmanMapper.selectCount(qw));
        //3.返回
        return page;
    }
}


